package ink.lovejinhu.GoldenCodeOfProgrammerInterview;

/**
 * @author jinhu
 * created 2021-08-10 9:26
 */
public class Interview_0107 {
    /**
     * 旋转矩阵
     *
     * @param matrix
     */
    public void rotate(int[][] matrix) {
        int[][] res = new int[matrix.length][matrix.length];
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix.length; j++) {
                res[j][matrix.length - 1 - i] = matrix[i][j];
            }
        }
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix.length; j++) {
                matrix[i][j] = res[i][j];
            }
        }

    }
}
